package basic;

import java.util.ArrayList;
import java.util.Iterator;


public class CrtMesh {

	private ArrayList<Polygon> meshsPrimitives;
	private String type;
	public CrtMesh(String type) {
		this.type=type;
		this.meshsPrimitives= new ArrayList<Polygon>();

	}
	public void addMeshPrimitive(Polygon tm) {
		meshsPrimitives.add(tm);
	}
	public Iterator<Polygon> iterator() {
		return meshsPrimitives.iterator();
	}
	public int size() {
		return meshsPrimitives.size();
	}

	public void clearMesh()
	{
		this.meshsPrimitives.clear();
	}

	public void setPartArray(int index, ArrayList<Polygon> list)
	{
		this.meshsPrimitives.addAll(index, list);
	}
	public ArrayList<Polygon> getPolygon()
	{
		return this.meshsPrimitives;
	}

	public String toString() {
		String doc = "";
		doc += super.toString() + "\n";
		Iterator<Polygon> iterator = meshsPrimitives.iterator();
		while(iterator.hasNext()) doc += iterator.next().toString() + "\n";
		return doc;
	}


}
